﻿@using MvcControls
@using MvcControls.Controls.Base
@using MvcControls.Controls.Button
@using MvcControls.Controls.Parameters
@using SDM.Domain.Models
@using SDM.Main.Areas.App.Views.Warehouse
@inherits WebViewPage<ItemModel>, ILocalizable<Texts>, ILocalizable<ItemModel.Texts>
@{
    var isAddMode = Model != null && Model.IsNew;
    ViewBag.Title = this.Localize<Texts>(t => isAddMode ? t.AddItem : t.EditItem);
}
@using (Html.BeginForm())
{
    <div>
        @Html.LabelFor(t => t.Name, this.Localize<ItemModel.Texts>(t => t.Name))
        @Html.TextBoxFor(t => t.Name)
        @Html.ValidationMessageFor(t => t.Name)
    </div>
    <div>
        @Html.Custom().Render((IHtmlControl)ViewBag.ResultMessage)
    </div>
    @Html.Custom().Button().Settings(s =>
                                         {
                                             s.Text = this.Localize<Texts>(t => isAddMode ? t.Shared.Add : t.Shared.Save);
                                             s.Type = ButtonControlInfo.ButtonType.Submit;
                                         })
    @Html.Custom().Button().Settings(s =>
                                         {
                                             s.Text = this.Localize<Texts>(t => t.Shared.Cancel);
                                             s.Action = new ActionParameter("Items");
                                         })
}
